﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OliveChess
{
    // TODO: for better performances in c++, turn this class into a struct
    class GameState
    {
        public GameState()
        {
            lastEnPassant = Square.NO_SQUARE;
        }

        public bool turn;

        public int lastEnPassant; // empty square where the last double-pushed pawn can be captured

        public bool whiteCanCastleKingSide;
        public bool whiteCanCastleQueenSide;
        public bool blackCanCastleQueenSide;
        public bool blackCanCastleKingSide;
        public int halfMoveClock; //pliesSinceLastCaptureOrPawnMove
        public int fullMoveNumber; // incremented after each black ply

        // for 3-times repetition rule
        public String pseudoFen;

        public bool IsEqual(GameState gs)
        {
            return turn == gs.turn
                && lastEnPassant == gs.lastEnPassant
                && whiteCanCastleKingSide == gs.whiteCanCastleKingSide
                && whiteCanCastleQueenSide == gs.whiteCanCastleQueenSide
                && blackCanCastleKingSide == gs.blackCanCastleKingSide
                && blackCanCastleQueenSide == gs.blackCanCastleQueenSide
                && halfMoveClock == gs.halfMoveClock
                && fullMoveNumber == gs.fullMoveNumber;
        }
    }
}
